<template>
  <div class="password-box">
    <div class="dis-center">
      <van-button type="info" @click="goHome">返回首页</van-button>
    </div>
    <van-form @submit="onSubmit">
      <van-field
        v-model="formData.oldPassword"
        name="原密码"
        type="password"
        label="原密码"
        placeholder="原密码"
        :rules="[{ required: true, message: '请填写原密码' }]"
      />
      <van-field
        v-model="formData.newPassword"
        type="password"
        name="新密码"
        label="新密码"
        placeholder="新密码"
        :rules="[{ required: true, message: '请填写新密码' }]"
      />
      <van-field
        v-model="formData.newTwoPassword"
        type="password"
        name="确认密码"
        label="确认密码"
        placeholder="确认密码"
        :rules="[{ required: true, message: '请填写确认密码' }]"
      />
      <div style="margin: 16px">
        <van-button round block type="info" native-type="submit"
          >提交</van-button
        >
      </div>
    </van-form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      formData: {
        oldPassword: "",
        newPassword: "",
        newTwoPassword: "",
      },
    };
  },
  methods: {
    onSubmit(values) {
      console.log("submit", values);
    },
    goHome() {
      this.$router.push({ path: "/" });
    },
  },
};
</script>

<style lang="less">
.password-box {
  padding: 20px;
  .van-field__label {
    font-size: 16px;
  }
  .dis-center {
    display: flex;
    justify-content: end;
  }
}
</style>
